package random;

public final class Stats {
	public double endLength;
	public long pathLength;
	public long stepLength;
	public long manEndLength;
	public long n = 1;
	
	public final void add(Stats stats){
		endLength+=stats.endLength;
		manEndLength+=stats.manEndLength;
		pathLength+=stats.pathLength;
		stepLength+=stats.stepLength;
		this.n += stats.n;
	}
	
	public final void add2(Stats stats){
		endLength+=stats.endLength*stats.endLength;
		manEndLength+=stats.manEndLength*stats.manEndLength;
		pathLength+=stats.pathLength*stats.pathLength;
		stepLength+=stats.stepLength*stats.stepLength;
		this.n += stats.n;
	}
	
	public final void add3(Stats stats){
		endLength+=stats.endLength*stats.endLength*stats.endLength;
		manEndLength+=stats.manEndLength*stats.manEndLength*stats.manEndLength;
		pathLength+=stats.pathLength*stats.pathLength*stats.pathLength;
		stepLength+=stats.stepLength*stats.stepLength*stats.stepLength;
		this.n += stats.n;
	}
	
	public final void add4(Stats stats){
		endLength+=stats.endLength*stats.endLength*stats.endLength*stats.endLength;
		manEndLength+=stats.manEndLength*stats.manEndLength*stats.manEndLength*stats.manEndLength;
		pathLength+=stats.pathLength*stats.pathLength*stats.pathLength*stats.pathLength;
		stepLength+=stats.stepLength*stats.stepLength*stats.stepLength*stats.stepLength;
		this.n += stats.n;
	}
	
	public final void min(Stats stats){
		pathLength = (stats.pathLength < pathLength) ? stats.pathLength : pathLength;
		endLength = (stats.endLength < endLength) ? stats.endLength : endLength;
		stepLength = (stats.stepLength < stepLength) ? stats.stepLength : stepLength;
		manEndLength = (stats.manEndLength < manEndLength) ? stats.manEndLength : manEndLength;
	}
	
	public final void max(Stats stats){
		pathLength = (stats.pathLength > pathLength) ? stats.pathLength : pathLength;
		endLength = (stats.endLength > endLength) ? stats.endLength : endLength;
		stepLength = (stats.stepLength > stepLength) ? stats.stepLength : stepLength;
		manEndLength = (stats.manEndLength > manEndLength) ? stats.manEndLength : manEndLength;
	}
}
